
#ifndef __CE_GFX_MESH_H__
#define __CE_GFX_MESH_H__

#include <export.h>
#include <asset/asset.h>
#include <gfx/enum.h>
#include <math/boundingbox.h>

struct iIndexBuffer;
struct iVertexBuffer;
struct iVertexDeclaration;

/**
 * \addtogroup graphics
 * @{
 */
/**
 * @brief Low level implementation of a mesh
 */
class CE_API ceMesh : public ceAsset
{
	CE_ASSET_ID4('m', 'e', 's', 'h')
  CE_OBJECT
private:
  iVertexBuffer*        _vertices;
  iIndexBuffer*         _indices;
  iVertexDeclaration*   _vertexDeclaration;
  unsigned              _primCount;
  ceDataType            _indexDataType;
  ceBoundingBox         _bbox;
  cePrimitiveType       _primType;
public:
  ceMesh();
  virtual ~ceMesh ();

  void SetPrimitiveType (cePrimitiveType type);
  cePrimitiveType GetPrimitiveType () const;

  void SetNumberOfTrigons (unsigned numberOfTrigons);
  unsigned GetNumberOfTrigons () const;

  void SetNumberOfLines (unsigned numberOfLines);
  unsigned GetNumberOfLines () const;

  unsigned GetNumberOfPrims () const;

  void Set32BitIndices (bool bit32);
  bool Is32BitIndices () const;
  ceDataType GetIndexDataType () const;

  void SetVertices (iVertexBuffer* vertices);
  iVertexBuffer* GetVertices ();
  const iVertexBuffer* GetVertices () const;

  void SetIndices (iIndexBuffer* indices);
  iIndexBuffer* GetIndices ();
  const iIndexBuffer* GetIndices () const;

  void SetVertexDeclaration (iVertexDeclaration* vertexDeclaration);
  iVertexDeclaration* GetVertexDeclration ();
  const iVertexDeclaration* GetVertexDeclration () const;

  void SetBoundingBox (const ceBoundingBox& bbox);
  ceBoundingBox& GetBoundingBox ();
  const ceBoundingBox& GetBoundingBox () const;
};


/** @} */

#endif /* ! __CE_GFX_MESH_H__ */
